package com.itheima.springboot_02_configration.controller;

import org.springframework.web.bind.annotation.*;

//@Controller //声明这个类,将来可以作为bean的属性,要在xml中跟搜索域配合
@RestController
public class UsersController {

    @RequestMapping(value = "/users/{id}", method = RequestMethod.GET)
    @ResponseBody
    public String get(@PathVariable Integer id) {
        System.out.println("get:" + id);
        return "get";
    }

    @RequestMapping(value = "/users", method = RequestMethod.POST)
    @ResponseBody
    public String save() {
        System.out.println("save");
        return "save";
    }

    @RequestMapping(value = "/users/{id}", method = RequestMethod.PUT)
    @ResponseBody
    public String update(@PathVariable Integer id) {
        System.out.println("put:" + id);
        return "put";
    }

    @RequestMapping(value = "/delete/{id}", method = RequestMethod.DELETE)
    @ResponseBody
    public String delete(@PathVariable Integer id) {
        System.out.println("delete" + id);
        return "delete";
    }
}
